package tuiLayer;


import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import modelLayer.*;
import java.util.Date;
/**
 * The test class Test.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */
public class Tests
{
    Customer c;
    Item item1,set;
    Staff s;
    SaleLine sl,sl2;
    Sale sale;
    /**
     * Default constructor for test class Test
     */
    public Tests()
    {
    }

    /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
    @Before
    public void setUp()
    {
        //create customer/item1/item2/staff
        c=new Customer("Richard", "Aarborg", "123", 123, false);
        item1=new NormalItem("Desk", 100, 001,10,"DIY");
        set=new Set("Bedroom", 250, 002);
        s=new Staff("Leo", "123456789", 1234, "Leo", "123",false);
    }
    @Test
    public void addItemsToSet(){        
        ((Set)set).addSetItem(002);
        ((Set)set).addSetItem(002);
        ((Set)set).addSetItem(002);
    }
    @Test
    public void addCustomerToContainer(){
        CustomerContainer.getInstance().addCustomer(c);
        assertEquals(1,CustomerContainer.getInstance().getAllCustomers().size());
        
    }
    @Test
    public void addStaffToContainer(){
         StaffContainer.getInstance().addStaff(s);
    }
    @Test
    public void createNewSale(){
        sl=new SaleLine(001,item1.getPrice(),2);
        sl2=new SaleLine(002,set.getPrice(),1);
        sale=new Sale(sl.getPrice()*2+sl2.getPrice(), new Date().toString(), s);
        assertEquals(450,sale.getTotalPrice(),0);
    }
    /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
    @After
    public void tearDown()
    {
       
    }
}
